package com.banshou.installs.ui.adapter;

import android.content.Context;
import android.view.View;

import com.banshou.installs.R;
import com.banshou.installs.model.dao.ResponseStaff;
import com.zhy.adapter.recyclerview.CommonAdapter;
import com.zhy.adapter.recyclerview.base.ViewHolder;

import java.util.List;

/**
 * Created by cjq on 2018/1/2.
 * Email: stoic_yb@139.com
 * features:
 */

public class StaffManAdapter extends CommonAdapter<ResponseStaff.Employee> {

    private OnItemClickListener onItemClickListener;

    public interface OnItemClickListener{
        void onItemClick(int position);
    }

    public void setOnItemClickListener(OnItemClickListener onItemClickListener){
        this.onItemClickListener = onItemClickListener;
    }

    public StaffManAdapter(Context context, int layoutId, List<ResponseStaff.Employee> datas) {
        super(context, layoutId, datas);
    }

    @Override
    protected void convert(ViewHolder holder, ResponseStaff.Employee employee, final int position) {
        holder.setText(R.id.name,mDatas.get(position).getPost());
        holder.setText(R.id.tel,mDatas.get(position).getPhone());
        holder.setOnClickListener(R.id.delete, view -> onItemClickListener.onItemClick(position));
    }
}
